#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <string.h>
#include <assert.h>

#include "../drv/drv_timer.h"
#include "../drv/drv_uart.h"
#include "venus638.h"

//Interrupt sub routine
static void VENUS638Handler( S_Gpgga *gpgga   );


S_Gpgga gpgga_frame;
// file descriptor pour le port série du GPS
int fd = 0;


int VENUS638Init( void )
{
	printf("VENUS638 Init\n");
	//on ouvre le port uart
	fd = drv_uartOpen("/dev/ttyAMA0", (drv_uartCallbackHandler)VENUS638Handler);

	return fd;
}


void VENUS638Read( S_Gpgga *gpgga )
{
	*gpgga = gpgga_frame;

}

//Interrupt sub routine
static void VENUS638Handler( S_Gpgga *gpgga )
{
	gpgga_frame = *gpgga;
	/*printf("gpgga_frame.time => %s\n",gpgga_frame.time);
	printf("gpgga_frame.latitude => %s\n",gpgga_frame.latitude);
	printf("gpgga_frame.longitude => %s\n",gpgga_frame.longitude);
	printf("gpgga_frame.quality => %s\n",gpgga_frame.quality);
	printf("gpgga_frame.nb_satellites => %s\n",gpgga_frame.nb_satellites);
	printf("gpgga_frame.hdop => %s\n",gpgga_frame.hdop);
	printf("gpgga_frame.altitude => %s\n",gpgga_frame.altitude);
	printf("gpgga_frame.geoidal => %s\n",gpgga_frame.geoidal);
	printf("gpgga_frame.last_update => %s\n",gpgga_frame.last_update);
	printf("gpgga_frame.station_id => %s\n",gpgga_frame.station_id);
	printf("gpgga_frame.check_sum => %s\n",gpgga_frame.check_sum);*/
	

}





